/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainForm.java
 *
 * Created on Jun 3, 2010, 8:11:35 AM
 */

package GUI;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

/**
 *
 * @author Ga`_Bao_Chu'a
 */
public class MainForm extends javax.swing.JFrame {

    StandardizePanel sp = new StandardizePanel();
    BuildTrainingPanel btp = new BuildTrainingPanel();
    TrainPanel tap = new TrainPanel();

    JPanel currentPanel = null;

    /** Creates new form MainForm */
    public MainForm() {
        initComponents();
        sp.setBounds(jPanel1.getBounds());
        jPanel1.add(sp);
        sp.setVisible(false);

        btp.setBounds(jPanel1.getBounds());
        jPanel1.add(btp);
        btp.setVisible(false);

        tap.setBounds(jPanel1.getBounds());
        jPanel1.add(tap);
        tap.setVisible(false);

  
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jmProgram = new javax.swing.JMenu();
        jmiBuildTraining = new javax.swing.JMenuItem();
        jmiTrain = new javax.swing.JMenuItem();
        jmiStandardize = new javax.swing.JMenuItem();
        jmiExit = new javax.swing.JMenuItem();
        jmHelp = new javax.swing.JMenu();
        jmiHowToUse = new javax.swing.JMenuItem();
        jmiAbout = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Chuẩn hóa văn bản nâng cao");
        setBounds(new java.awt.Rectangle(0, 0, 1000, 700));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setName("frmMainForm"); // NOI18N
        setResizable(false);

        jPanel1.setBackground(java.awt.Color.white);
        jPanel1.setPreferredSize(new java.awt.Dimension(500, 400));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1003, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 585, Short.MAX_VALUE)
        );

        jmProgram.setText("Chương trình");

        jmiBuildTraining.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        jmiBuildTraining.setText("Xây dựng tập huấn luyện");
        jmiBuildTraining.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiBuildTrainingActionPerformed(evt);
            }
        });
        jmProgram.add(jmiBuildTraining);

        jmiTrain.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        jmiTrain.setText("Huấn luyện");
        jmiTrain.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiTrainActionPerformed(evt);
            }
        });
        jmProgram.add(jmiTrain);

        jmiStandardize.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        jmiStandardize.setText("Chuẩn hóa");
        jmiStandardize.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiStandardizeActionPerformed(evt);
            }
        });
        jmProgram.add(jmiStandardize);

        jmiExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        jmiExit.setText("Thoát");
        jmiExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiExitActionPerformed(evt);
            }
        });
        jmProgram.add(jmiExit);

        jMenuBar1.add(jmProgram);

        jmHelp.setText("Giúp đỡ");

        jmiHowToUse.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        jmiHowToUse.setText("Hướng dẫn sử dụng");
        jmHelp.add(jmiHowToUse);

        jmiAbout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK));
        jmiAbout.setText("Thông tin");
        jmiAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiAboutActionPerformed(evt);
            }
        });
        jmHelp.add(jmiAbout);

        jMenuBar1.add(jmHelp);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 1003, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmiStandardizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiStandardizeActionPerformed
        // TODO add your handling code here:
        if(currentPanel!=null){
            currentPanel.setVisible(false);
        }
        currentPanel = sp;
        currentPanel.setVisible(true);
//        sp.revalidate();
//        jPanel1.repaint();
    }//GEN-LAST:event_jmiStandardizeActionPerformed

    private void jmiBuildTrainingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiBuildTrainingActionPerformed
        // TODO add your handling code here:
        if(currentPanel!=null){
            currentPanel.setVisible(false);
        }
        currentPanel = btp;
        currentPanel.setVisible(true);
        
//        sp.revalidate();
//        jPanel1.repaint();
    }//GEN-LAST:event_jmiBuildTrainingActionPerformed

    private void jmiTrainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiTrainActionPerformed
        // TODO add your handling code here:
        if(currentPanel!=null){
            currentPanel.setVisible(false);
        }
        currentPanel = tap;
        currentPanel.setVisible(true);
        
//        tap.revalidate();
//        jPanel1.repaint();
    }//GEN-LAST:event_jmiTrainActionPerformed

    private void jmiExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiExitActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        this.dispose();
    }//GEN-LAST:event_jmiExitActionPerformed

    private void jmiAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiAboutActionPerformed
        // TODO add your handling code here:
        JOptionPane.showMessageDialog(this, "Chương trình demo chuẩn hóa văn bản cấp cao\nPhiên bản: 1.0\n\nTác giả: Phạm Thị Thanh\nĐiện thoại: 0915334577\nEmail: iambee2000@gmail.com", "Thông tin", JOptionPane.INFORMATION_MESSAGE);
    }//GEN-LAST:event_jmiAboutActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JMenu jmHelp;
    private javax.swing.JMenu jmProgram;
    private javax.swing.JMenuItem jmiAbout;
    private javax.swing.JMenuItem jmiBuildTraining;
    private javax.swing.JMenuItem jmiExit;
    private javax.swing.JMenuItem jmiHowToUse;
    private javax.swing.JMenuItem jmiStandardize;
    private javax.swing.JMenuItem jmiTrain;
    // End of variables declaration//GEN-END:variables

}
